package com.issue.system.service.impl;

import java.util.List;
import com.issue.common.utils.DateUtils;
import com.issue.common.utils.SecurityUtils;
import com.issue.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.issue.system.mapper.ChildAttendanceMapper;
import com.issue.system.domain.ChildAttendance;
import com.issue.system.service.IChildAttendanceService;

/**
 * AttendanceService业务层处理
 * 
 * @author system
 * @date 2024-10-20
 */
@Service
public class ChildAttendanceServiceImpl implements IChildAttendanceService 
{
    @Autowired
    private ChildAttendanceMapper childAttendanceMapper;

    /**
     * 查询Attendance
     * 
     * @param id Attendance主键
     * @return Attendance
     */
    @Override
    public ChildAttendance selectChildAttendanceById(Long id)
    {
        return childAttendanceMapper.selectChildAttendanceById(id);
    }

    /**
     * 查询Attendance列表
     * 
     * @param childAttendance Attendance
     * @return Attendance
     */
    @Override
    public List<ChildAttendance> selectChildAttendanceList(ChildAttendance childAttendance)
    {
        return childAttendanceMapper.selectChildAttendanceList(childAttendance);
    }

    /**
     * 新增Attendance
     * 
     * @param childAttendance Attendance
     * @return 结果
     */
    @Override
    public int insertChildAttendance(ChildAttendance childAttendance)
    {
        childAttendance.setCreateTime(DateUtils.getNowDate());
        if (StringUtils.isNotEmpty(SecurityUtils.getUsername())) {
            childAttendance.setCreateBy(SecurityUtils.getUsername());
        }
        return childAttendanceMapper.insertChildAttendance(childAttendance);
    }

    /**
     * 修改Attendance
     * 
     * @param childAttendance Attendance
     * @return 结果
     */
    @Override
    public int updateChildAttendance(ChildAttendance childAttendance)
    {
        childAttendance.setUpdateTime(DateUtils.getNowDate());
        if (StringUtils.isNotEmpty(SecurityUtils.getUsername())) {
            childAttendance.setUpdateBy(SecurityUtils.getUsername());
        }
        return childAttendanceMapper.updateChildAttendance(childAttendance);
    }

    /**
     * 批量删除Attendance
     * 
     * @param ids 需要删除的Attendance主键
     * @return 结果
     */
    @Override
    public int deleteChildAttendanceByIds(Long[] ids)
    {
        return childAttendanceMapper.deleteChildAttendanceByIds(ids);
    }

    /**
     * 删除Attendance信息
     * 
     * @param id Attendance主键
     * @return 结果
     */
    @Override
    public int deleteChildAttendanceById(Long id)
    {
        return childAttendanceMapper.deleteChildAttendanceById(id);
    }
}
